package com.gin.kotlin.no_gay_alliance.database

import androidx.room.AutoMigration
import androidx.room.Database
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.gin.kotlin.no_gay_alliance.database.converter.MyTypeConverter
import com.gin.kotlin.no_gay_alliance.database.dao.BanKeywordDao
import com.gin.kotlin.no_gay_alliance.database.dao.BanTopicDao
import com.gin.kotlin.no_gay_alliance.database.dao.BanUserDao
import com.gin.kotlin.no_gay_alliance.database.dao.EmojiHistoryDao
import com.gin.kotlin.no_gay_alliance.database.dao.IpLocationHistoryDao
import com.gin.kotlin.no_gay_alliance.database.dao.NgaAccountDao
import com.gin.kotlin.no_gay_alliance.database.dao.NoticeMsgDao
import com.gin.kotlin.no_gay_alliance.database.dao.PostDraftDao
import com.gin.kotlin.no_gay_alliance.database.dao.ReplyHistoryDao
import com.gin.kotlin.no_gay_alliance.database.dao.ReplyHistoryTaskDao
import com.gin.kotlin.no_gay_alliance.database.dao.ReplyHistoryTaskLogDao
import com.gin.kotlin.no_gay_alliance.database.dao.ReplyHistoryTopicDao
import com.gin.kotlin.no_gay_alliance.database.dao.ReplyHistoryUserDao
import com.gin.kotlin.no_gay_alliance.database.dao.ReportHistoryDao
import com.gin.kotlin.no_gay_alliance.database.dao.TopicBookmarkDao
import com.gin.kotlin.no_gay_alliance.database.dao.TopicHistoryDao
import com.gin.kotlin.no_gay_alliance.database.entity.BanKeyword
import com.gin.kotlin.no_gay_alliance.database.entity.BanTopic
import com.gin.kotlin.no_gay_alliance.database.entity.BanUser
import com.gin.kotlin.no_gay_alliance.database.entity.EmojiHistory
import com.gin.kotlin.no_gay_alliance.database.entity.IpLocationHistory
import com.gin.kotlin.no_gay_alliance.database.entity.NgaAccount
import com.gin.kotlin.no_gay_alliance.database.entity.NoticeMsg
import com.gin.kotlin.no_gay_alliance.database.entity.PostDraft
import com.gin.kotlin.no_gay_alliance.database.entity.ReplyHistory
import com.gin.kotlin.no_gay_alliance.database.entity.ReplyHistoryTask
import com.gin.kotlin.no_gay_alliance.database.entity.ReplyHistoryTaskLog
import com.gin.kotlin.no_gay_alliance.database.entity.ReplyHistoryTopic
import com.gin.kotlin.no_gay_alliance.database.entity.ReplyHistoryUser
import com.gin.kotlin.no_gay_alliance.database.entity.ReportHistory
import com.gin.kotlin.no_gay_alliance.database.entity.TopicBookmark
import com.gin.kotlin.no_gay_alliance.database.entity.TopicHistory

@Database(
    version = 11,
    entities = [
        NgaAccount::class,
        TopicHistory::class,
        EmojiHistory::class,
        NoticeMsg::class,
        IpLocationHistory::class,
        PostDraft::class,
        TopicBookmark::class,
        BanUser::class,
        BanKeyword::class,
        ReportHistory::class,
        ReplyHistory::class,
        ReplyHistoryTopic::class,
        ReplyHistoryUser::class,
        ReplyHistoryTask::class,
        ReplyHistoryTaskLog::class,
        BanTopic::class,
    ],
    autoMigrations = [
        AutoMigration(from = 1, to = 2),
        AutoMigration(from = 2, to = 3),
        AutoMigration(from = 3, to = 4),
        AutoMigration(from = 4, to = 5),
        AutoMigration(from = 5, to = 6),
        AutoMigration(from = 6, to = 7),
        AutoMigration(from = 7, to = 8),
        AutoMigration(from = 8, to = 9),
        AutoMigration(from = 9, to = 10),
        AutoMigration(from = 10, to = 11),
    ]
)
@TypeConverters(MyTypeConverter::class)
abstract class NgaDatabase : RoomDatabase() {
    abstract fun accountDao(): NgaAccountDao
    abstract fun topicHistoryDao(): TopicHistoryDao
    abstract fun emojiHistoryDao(): EmojiHistoryDao
    abstract fun noticeMsgDao(): NoticeMsgDao
    abstract fun ipLocationHistoryDao(): IpLocationHistoryDao
    abstract fun postDraftDao(): PostDraftDao
    abstract fun topicBookmarkDao(): TopicBookmarkDao
    abstract fun banUserDao(): BanUserDao
    abstract fun banKeywordDao(): BanKeywordDao
    abstract fun reportHistoryDao(): ReportHistoryDao
    abstract fun replyHistoryDao(): ReplyHistoryDao
    abstract fun replyHistoryTopicDao(): ReplyHistoryTopicDao
    abstract fun replyHistoryUserDao(): ReplyHistoryUserDao
    abstract fun replyHistoryTaskDao(): ReplyHistoryTaskDao
    abstract fun replyHistoryTaskLogDao(): ReplyHistoryTaskLogDao
    abstract fun banTopicDao(): BanTopicDao
}